﻿function getYoutube(){	
		jQuery.post('/auth',{'action':'getVideos','token': $.cookie('tokenbridge')},function (res){
		jQuery('#userItems').html('');
		if (res.feed.entry!=undefined){
		 		jQuery.each(res.feed.entry,function(i,videos){
		 			if (videos.media$group.yt$private==undefined){
		 				jQuery('#userItems').append('<div class="media-wrapper"><img src="'+videos.media$group.media$thumbnail[0].url+'" width="79" height="44"/><input id="video'+i+'" type="checkbox" value="'+videos.link[0].href+'" class="flag"/></div>'); 		
		 			}
		 		})	
		}else{
			jQuery('#userItems').append('<p>'+JSONIdiomas[lng][0].nouseritems+'</p>'); 		
		}
	},'json');
}

function getPicasa(){	
	jQuery.post('/auth',{'action':'getPhotos','token': $.cookie('tokenbridge')},function (res){ 		
		jQuery('#userItems').html('');
		if (res.feed.entry!=undefined){
			jQuery.each(res.feed.entry,function(i,fotos){			
				jQuery('#userItems').append('<div class="media-wrapper"><img src="'+fotos.content.src+'" width="79" height="44" /><input type="checkbox" id="photo'+i+'" value="'+fotos.content.src+'" class="flag"/></div>'); 
			})	
		}else{
			jQuery('#userItems').append('<p>'+JSONIdiomas[lng][0].nouseritems+'</p>'); 		
		}
	},'json');
}

function checkToken(){
	scope = "http://picasaweb.google.com/data/ http://gdata.youtube.com";
	token = google.accounts.user.checkLogin(scope);
	if (token!="" && token!=null){
		return(1);
	}else{
		return(0);
	}
}

